<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>新增菜品分类</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.min.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<script src="__PUBLIC__/Plugins/Datepicker/WdatePicker.js"></script>
</head>

<body>
	<div class="page_wraper">
		<div id="tab1_0" style="padding-left:8px;">
			<form id="form_ele">
			<input type="hidden" name="solevar" value="{:create_id()}" />
				<table cellpadding="0" cellspacing="0" class="module_form interlaceColor">
				<eq name="row.id" value="">
				<else />
					<tr>
						<td class="ele_title"><label for="title">上级栏目：</label></td>
						<td class="ele_content">
							{$title}
							<input type="hidden" name="pid"   value="{$row.id}" />
							<input type="hidden" name="level" value="{$row.level}" />
						</td>
					</tr>
				</eq>
					<!-- <tr>
						<td class="ele_title"><label for="title">字典类型：</label></td>
						<td class="ele_content">
							<input type="radio" name="type" value="1" checked />&nbsp;一级字典&nbsp;&nbsp;&nbsp;&nbsp;
							<input type="radio" name="type" value="2" />&nbsp;无限级字典
						</td>
					</tr> -->
					<tr>
						<td class="ele_title"><label for="title">字典标识：</label></td>
						<td class="ele_content">
							<input type="text" name="key" value="{$row.key}" id="keys" class="form_ele_text width_300" readonly />
						</td>
					</tr>
					<foreach name="lang" key="k" item="v">
						<tr>
							<td class="ele_title"><label for="title">{$v}名称：</label></td>
							<td class="ele_content">
								<input type="text" name="value[{$k}]" class="form_ele_text width_300" />
							</td>
						</tr>
					</foreach>
					<tr>
						<td class="ele_title"><label for="sort">排序号：</label></td>
						<td class="ele_content">
							<input type="text" name="sort" value="1" class="form_ele_text width_300" />
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="button" value="提交数据"  class="form_ele_submit"/>
		<input type="reset"  name="reset"  value="清空数据"  class="form_ele_reset"/>
	</div>
</body>
<script type="text/javascript">
	//弹出窗口全局变量
	var api = frameElement.api, W = api.opener;

	$(function(){
		//重置
		$('.form_ele_reset').on('click',function(){
			frameApi.close(); //关闭当前窗口
		});
		//提交
		$('.form_ele_submit').on('click',function(){
			
			var tipsObj = windowApi.lhgdialog.tips('正在提交数据...',10,etIcon.loading);
			
			//通过Ajax提交表单
			var postData = {};
			postData = $("#form_ele").serialize();
			var keys = $("#keys").val();
			$.post("{:U('Dict/add')}", postData , function(data){
			
				if(data.status==1){
					windowApi.lhgdialog.tips('数据提交成功！');
				    //var obj = windowApi.lhgdialog.list['Dict_index'];
					//obj.reload(obj);
					//frameApi.close(); //关闭当前窗口
					window.location.href="{:U('Dict/index')}&key="+keys;
				}else{
					windowApi.lhgdialog.alert(data.info);
				}
			}, "json");
					
		});
	});
</script>
</html>
